<!DOCTYPE HTML>
<html>
<meta charset="UTF-8">
<!-- awwwb.com -->
<head>
    <script type="text/javascript">
        function resCalc()
        {
            numA=document.getElementById("num_a").value;
            numB=document.getElementById("num_b").value;
            document.getElementById("result").value=Number(numA)+Number(numB);
        }
    </script>
</head>
<body>
<p>使用 output 元素的简易计算器：</p>
<form onsubmit="return false">
    <input id="num_a" /> +
    <input id="num_b" /> =
    <output id="result" onforminput="resCalc()"></output>
</form>

</body>

<!-- awwwb.com -->
</html>
